package com.example.ecs.components.render;

import com.example.ecs.core.ComponentKey;

import java.awt.Color;
import java.awt.Graphics2D;

/**
 * RectangleRenderComponent类表示矩形渲染组件
 */
@ComponentKey(RenderableComponent.class)
public class RectangleRenderComponent extends RenderableComponent {
    public int width, height;
    
    public RectangleRenderComponent(Color color, int width, int height) {
        super(color);
        this.width = width;
        this.height = height;
    }
    
    @Override
    public void render(Graphics2D g, double x, double y) {
        g.setColor(color);
        g.fillRect((int)x, (int)y, width, height);
    }
}